package com.yykj.bank.server.controller;

import com.yykj.bank.client.dto.BankInfoDTO;
import com.yykj.bank.client.dto.BankVerifyDTO;
import com.yykj.bank.client.vo.BankVerifyResultVO;
import com.yykj.bank.server.model.entity.BankInfo;
import com.yykj.bank.server.service.BankCardCheckService;
import com.yykj.bank.server.service.BankInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "银行相关接口")
@RestController
@RequestMapping("/api/bank")
public class BankController {

    @ApiOperation("银行卡，姓名，身份证号校验")
    @PostMapping("/verify")
    public BankVerifyResultVO verify(@RequestBody BankVerifyDTO dto){
        return bankCardCheckService.verify(dto);
    }

    @ApiOperation("可用银行卡列表")
    @GetMapping("/available/bank")
    public List<BankInfoDTO> listAvailableBank(){
        return bankInfoService.listAvailableBank();
    }

    private BankCardCheckService bankCardCheckService;

    private BankInfoService bankInfoService;

    @Autowired
    public void setBankCardCheckService(BankCardCheckService bankCardCheckService) {
        this.bankCardCheckService = bankCardCheckService;
    }

    @Autowired
    public void setBankInfoService(BankInfoService bankInfoService) {
        this.bankInfoService = bankInfoService;
    }
}
